package com.hmall.order.interceptors;

import com.hmall.order.utils.UserHolder;
import feign.RequestInterceptor;
import feign.RequestTemplate;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

@Slf4j
@Component
public class MyFeignInterceptor implements RequestInterceptor {
    @Override
    public void apply(RequestTemplate template) {

        Long userId = UserHolder.getUserId();
        log.info("userId={}",userId);

        //        设置头信息
        template.header("authorization", "2");
    }
}
